using System.Data.SqlClient;

namespace sprocgen.Entities
{
    public class ConnectionConfig
    {
        public string Server;
        public string Database;
        public string UserName;
        public string Password;
        public bool IsTrustedConnection;

        public string GetConnectionString()
        {
            SqlConnectionStringBuilder connectionStringBuilder = new SqlConnectionStringBuilder();
            connectionStringBuilder.DataSource = Server;
            connectionStringBuilder.InitialCatalog = Database;
            if (IsTrustedConnection)
            {
                connectionStringBuilder.IntegratedSecurity = true;
            }
            else
            {
                connectionStringBuilder.UserID = UserName;
                connectionStringBuilder.Password = Password;
            }

            return connectionStringBuilder.ToString();
        }
    }
}
